from elixir import *

from sqlalchemy import func, DynamicMetaData
tags_metadata = DynamicMetaData()

class Tag(Entity):
    using_options(metadata=tags_metadata, tablename='tag')
    #using_table_options(mysql_engine='MyISAM')
    with_fields (
        name = Field(String(255), unique=True, index=True)
    )
    # Tag and Task are in different databases, so we cannot 
    # have any relation between them.
    #has_and_belongs_to_many("tasks", of_kind="Task", inverse="tags")
    def __init__(self, name):
        self.name = name 
    def __repr__(self):
        return str(self)
    def __str__(self):
        return "<Tag %s>" % self.name
